<template>
  <div id="download">
    <h2>{{voteDetails.title}}</h2>
    <p>{{voteDetails.content}}</p>
    <h3>附件图：</h3>
    <ul>
      <li v-for="(item, index) in imgList"  :key="index">
        <img :src="item" alt="附件图"  :preview="index"/>
      </li>
    </ul>
  </div>
</template>

<script>
import { Toast, Dialog } from "mand-mobile";
import https from "@/https";
import config from "@/config";
export default {
  components: {
    [Dialog.name]: Dialog,
  },
  name: "modify",
  data() {
    return {
      voteDetails: [], //提议详情,
      imgList: [], //
    };
  },
  methods: {
    //获取提议详情
    getVoteDetails() {
      let number = this.$route.query.number;
      let params = {
        number
      };
      https
        .fetchPost(config.voteDetails, params)
        .then(res => {
          if (res.data.code == 1) {
            let data = res.data.data[0];
            if(data.files != ""){
              let file = data.files[0].file;
              this.imgList = [...file.split(",")];
            }else {
              this.imgList = [];
            }
            this.voteDetails = data;
            this.$previewRefresh();
          } else {
            Toast.failed(res.data.msg, 2000);
            return;
          }
        })
        .catch(err => {
          console.log(err);
        });
    }
  },
  created() {
    this.getVoteDetails();
  }
};
</script>

<style  lang="scss" scoped>
$themeColor: #444444;
$themeGold: #d7b987;
.md-notice-bar {
  z-index: 1;
}
button {
  z-index: 1;
}
.pswp {
  z-index: 99999;
}
#download {
  padding: 40px 30px;
  h2 {
    font-size: 40px;
    margin-bottom: 50px;
    color: #444444;
    text-align: center;
  }
  p {
    margin-bottom: 40px;
    font-size: 26px;
    line-height: 45px;
    text-indent: 2em;
    color: #666;
  }
  h3 {
    height: 80px;
    display: flex;
    align-items: center;
    font-size: 30px;
    margin-bottom: 30px;
    .img-tip {
        font-size: 24px;
        color: #e22c1f;
      }
    &::before {
      content: "";
      display: block;
      height: 38px;
      border-left: 6px solid $themeGold;
      margin-right: 28px;
    }
  }
  ul {
      display: flex;
    flex-wrap: wrap;
    li {
      display: flex;
      justify-content: center;
      overflow: hidden;
      border-radius: 12px;
      border: 1px solid #f2f2f2;
      margin: 10px;
      width: 200px;
      img {
        display: block;
        height: 200px;
      }
    }
  }
}
</style>
